package cn.hxzy.zyicon.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.UpdateTimestamp;
import javax.persistence.*;
import java.util.Date;
import java.io.Serializable;

/**
 * (Image)实体类
 *
 * @author makejava
 * @since 2020-08-13 11:34:07
 */

@Entity
@Table
@Data
public class Image implements Serializable {
    private static final long serialVersionUID = -14982273298412022L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;
    
    private String name;
    
    private String url;

    /**每次对象插入数据库就会有创建时间
     *
     */
    @CreationTimestamp
    /**插入数据库之后此字段不让修改
     *
     */
    @Column(updatable = false)
    /**转成json字符串时的格式和时区
     *
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;

    @UpdateTimestamp
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date updateTime;



}